<template>
  <div class="wapper">
    <el-container style="100%">
      <el-main style="background:#fff;">
        <div class="table-wrap">
          <div class="handle-box3">
            <el-form :inline="true" ref="form" :model="searchForm" class="demo-form-inline">
              <div class="uers-left">
                 <el-form-item label="查询结果：">
                   <el-tag ><b>{{label}}</b></el-tag>
                 </el-form-item>
                <br>
                 <el-form-item label="搜索：">
                  <el-input v-model="searchForm.name" placeholder="名称"></el-input>
                </el-form-item>
                 <el-form-item label="">
                  <el-input v-model="searchForm.phone" placeholder="手机"></el-input>
                </el-form-item>
                <el-form-item label="">
                  <el-date-picker v-model="searchForm.startDate" type="datetime" placeholder="开始日期"></el-date-picker>
                </el-form-item>
                <el-form-item label="">
                  <el-date-picker v-model="searchForm.endDate" type="datetime" placeholder="开始日期"></el-date-picker>
                </el-form-item>
                <el-button type="primary" icon="el-icon-search" @click="getData">搜索</el-button>
              </div>
            </el-form>
          </div>
          <div class="tabbox">
          <el-table
            :data="dataList"
            height="100%"
            border
            class="table"
            ref="multipleTable"
            :header-cell-style="{background:'#f2f6fc',color:'#606266'}"
            @selection-change="handleSelectionChange"
          >
            <el-table-column type="selection" width="55" align="center"></el-table-column>
            <el-table-column prop="name" label="姓名" align="center">
              <template slot-scope="scope">
                <span>{{scope.row.name}}</span>
              </template>
            </el-table-column>
            <el-table-column prop="phone" label="手机" align="center">
              <template slot-scope="scope">
                <span>{{scope.row.phone}}</span>
              </template>
            </el-table-column>
            <el-table-column prop="avatar" label="车型" align="center">
              <template slot-scope="scope">
                <span>{{scope.row.avatar}}</span>
              </template>
            </el-table-column>
            <el-table-column prop="amount" label="金额" align="center">
              <template slot-scope="scope">
                <span>{{scope.row.amount}}</span>
              </template>
            </el-table-column>
            <el-table-column prop="count" label="数量" align="center">
              <template slot-scope="scope">
                <span>{{scope.row.count}}</span>
              </template>
            </el-table-column>
            <el-table-column prop="isPay" label="是否支付" align="center">
              <template slot-scope="scope">
                <span>{{scope.row.isPay==0?"未支付":"已支付"}}</span>
              </template>
            </el-table-column>
            <el-table-column prop="createDate" label="创建日期" align="center">
              <template slot-scope="scope">
                <span>{{scope.row.createDate}}</span>
              </template>
            </el-table-column>
          </el-table></div>
          <div class="fb"><el-pagination
            class="pag"
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
            :current-page="currentPage"
            :page-sizes="[5, 10, 15, 20]"
            :page-size="pagesize"
            layout="total, sizes, prev, pager, next, jumper"
            :total="total"
            background
          ></el-pagination></div>
        </div>
      </el-main>
    </el-container>
  </div>
</template>
<script>

export default {
  data() {
    return {
      total: 0, //总条数
      currentPage: 1, //初始页
      pagesize: 15, // 每页的数据
      //表格高度适配
      tabheight: "",
      label:"",
      searchForm: {
        name: "",
        phone:"",
        endDate:new Date(new Date(new Date().toLocaleDateString()).getTime() + 24 * 60 * 60 * 1000 - 1),
        startDate:new Date(new Date(new Date().toLocaleDateString()).getTime())
      },
      ticketCom_Id: "",
      dataList: [
      ],
      multipleSelection: []
    };
  },
  mounted() {
    // this.tabheight=(this.$refs.getheight.offsetHeight-165)
  },
  created() {
    this.getData();
  },
  methods: {
    handleSizeChange(val) {
      this.pagesize = val;
      this.searchSubmit();
    },
    handleCurrentChange(val) {
      this.currentPage = val;
      this.searchSubmit();
    },
    searchSubmit() {
      var search = {
        name: this.searchForm.name,
        pageIndex: this.currentPage - 1,
        pageSize: this.pagesize,
        phone: this.searchForm.phone,
        startDate: this.searchForm.startDate,
        endDate: this.searchForm.endDate,
        projectId:localStorage.getItem("project_Id"),
      }
      this.$axios.post('/OrderForm/Search',search)
        .then(res =>{
          if (res.data.hasError == false) {
            this.dataList = [...res.data.data]
            this.total = res.data.total;
          }
        })

      this.$axios.post('/OrderForm/SearchAll',search)
        .then(res =>{
          if (res.data.hasError == false) {
            this.label="已支付购票数量："+res.data.data[0]+", 未支付购票票数："+res.data.data[1]+" ,已支付购票金额："+res.data.data[2]+" ,未支付购票金额："+res.data.data[3]+" ,云尚系统购票数量："+res.data.data[4]+" ,云尚系统购票金额："+res.data.data[5];
          }
        })
    },
    // 获取数据
    getData() {
      this.currentPage=1;
      this.searchSubmit();
    },
    handleSelectionChange(val) {
      this.multipleSelection = val;
    },
    isVerfy(id){
      
    }
  },
  components: {

  }
};
</script>
<style lang="scss" scope>
.pag {
  position: absolute;
  bottom: 0;
}
.table-wrap {
  height: 100%;
  margin-left: 10px;
}
.el-main{
  border-radius: 5px;
  position: relative;
}
.uers-left {
  float: left;
}
.uers-right {
  float: right;
}
.tabbox{
  height: calc(100% - 150px);
}
</style>